package dfs_and_bfs

import (
	"fmt"
	"strings"
)

type tNode struct {
	id string
	children []INode
}

func NewNode(id string) INode {
	return &tNode{
		id: id,
		children: make([]INode, 0),
	}
}


func (me *tNode) ID() string {
	return me.id
}

func (me *tNode) Append(child INode) {
	me.children = append(me.children, child)
}

func (me *tNode) Children() []INode {
	return me.children
}

func (me *tNode) String() string {
	items := make([]string, len(me.children))
	for i,it := range me.children {
		items[i] = it.ID()
	}
	return fmt.Sprintf("%v-[%s]", me.id, strings.Join(items, ","))
}

